
layui.use(['form', 'layedit', 'laydate'] ,function(){
    var upload = layui.upload;
    var layer = layui.layer;
    var form=layui.form;
    let $ = layui.$;

    $('#followContent').on('input', function() {
        var count = $(this).val().length;
        var maxCount = 300;
        $('.layui-word-aux').text('已输入' + count + '/' + maxCount);
    });
    // 渲染
    // upload.render({
    //     elem: '.demo-class-accept', // 绑定多个元素
    //     url: '', // 此处配置你自己的上传接口即可
    //     accept: 'file', // 普通文件
    //     done: function(res){
    //         layer.msg('上传成功');
    //         console.log(res);
    //     }
    // });
        $("#bao").click(function () {
            var type = $("#type").val();
            var mode = $("select[name='mode']").val();
            var followContent = $("#followContent").val();
            var cusName = $("#cusName").val();
            var custatus = $("select[name='custatus']").val();
            var contactUser = $("#contactUser").val();
            var who =$("#who").val();
            var followTime=$("#followTime").val();
            var data = {
                "type":type,
                "mode":mode,
                "followContent":followContent,
                "cusName":cusName,
                "custatus":custatus,
                "contactUser":contactUser,
                "who":who,
                "followTime":followTime

            }
            $.ajax({
                url:"/follow?action=addFollow",
                data:data,
                type:"post",

                success:function(res){
                    let parse = JSON.parse(res);
                    if(parse.code == 200){
                        layer.msg("添加成功")
                        setTimeout(function(){
                            layer.closeAll("iframe");
                            //刷新父页面
                            parent.location.reload();
                        },1000);
                    }else{
                        layer.msg("系统异常");
                    }

                }
            })
        });



    // 字数统计



});
